#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int* pa = (int*)calloc(10, sizeof(int));
	if (pa == NULL)
	{
		perror("calloc");
		return 1;
	}
	else
	{
		for (int i = 0; i < 10; i++)
		{
			*(pa + i) = i;
			printf("%d ", *(pa + i));
		}
	}
	int* ptr = (int*)realloc(pa, 5 * sizeof(int));
	if (ptr == NULL)
	{
		perror("realloc");
		return 1;
	}
	else
	{
		pa = ptr;
		ptr = NULL;
		for (int i = 0; i < 5; i++)
		{
			*(pa + i) = 1;
			printf("%d ", *(pa + i));
		}
	}
	
	free(pa);
	pa = NULL;
	return 0;
}